<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<title>下级列表</title>
		<%@include file="/WEB-INF/base.jspf"%>
		<style>
		 body {
		 	padding:30px;
		 }
		 .div-c-searchTool {
		 	display:flex;
		 	align-items:center;
		 }
		 .div-c-searchTool select.form-control {
		 	width:80px;
		 }
		 .div-c-searchTool input.form-control {
		 	width:200px;
		 }
		 .div-c-searchTool * {
		 	margin-right:6px;
		 }
		 .div-c-searchTool {
		 	margin-bottom:10px;
		 }
		 span.btn {
		 	cursor: default;
		 }
		 .bootstrap-background {
		 	color: #fff;
		    display:inline-block;
		    text-align:center;
		    white-space:nowrap;
		    vertical-align:middle;
		    border:1px solid transparent;
		    padding:5px 10px;
		    line-height:1.5;
		    border-radius:3px;
		    font-size:12px;
		    cursor: default;
		 }
		 .bootstrap-background.success {
		    background-color: #5cb85c;
		    border-color: #4cae4c;		 
		 }
		 .bootstrap-background.danger {
		    background-color: #d9534f;
		    border-color: #d9534f;		 
		 }		 
		 .bootstrap-background.info {
	 	    background-color: #5bc0de;
   			border-color: #46b8da;
		 }
 table th, table tr, table td {
	text-align: center;
	vertical-align: middle;
}
		</style>
	</head>
	<body style="">
	<div class="div-c-main">
		<div class="div-c-searchTool">
			<input class="form-control"  style="margin-right:10px;height:38px;"  type="text" name="" id="obj-date2" placeholder="开始时间" />
		<input class="form-control" id="input-i-account" placeholder="输入会员名查询" />
			<select class="form-control" id="select-i-accountType">
				<option value="">全部</option>
				<option value='1'>会员</option>
				<option value='2'>代理</option>
			</select>
			<button class="btn btn-primary" id="button-i-searchAJAXTable">查询</button>
			<button class="btn btn-primary" id="button-i-resetAJAXTable">重置</button>
		</div>
<table id="table-i-subLevelList" class="table-normal-datatables table table-striped table-bordered table-hover">
		<thead>
			<tr>
				<th>用户账号</th>
				<th>账号余额</th>
				<th>用户姓名</th>
				<th>用户类型</th>
				<th>注册时间</th>
				<th>最后登录时间</th>
				<th>最后登录ip</th>
				<th>状态</th>
			</tr>
		</thead>
		<tbody>
		</tbody>
	</table>		
	</div>	
	</body>
	<script type="text/javascript" src="/js/zhengzeTools.js"></script>
	<script>
	layui.use('laydate', function() {
		var laydate = layui.laydate;
		laydate.render({
			elem : '#obj-date1' 
		});
		laydate.render({
			elem : '#obj-date2' 
		});
	});

 		var dataTable = $("#table-i-subLevelList").DataTable({
		      // "bPaginate": true,
		      "bLengthChange": true,      
		      "bSort": false,
		      "bAutoWidth": false,
		      'aLengthMenu':[10, 20],
		       "searching": false,
		       "dom": `ftp`,
		       "language": {//语言设置  
		            "lengthMenu": "每页显示 _MENU_ 条记录",     
		            "zeroRecords": "没有检索到数据",     
		            "sInfo": "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",     
		            "info": "没有数据",     
		            "oPaginate": {     
		                "sFirst": "首页",     
		                "sPrevious": "前一页",     
		                "sNext": "后一页",     
		                "sLast": "尾页"    
		          	},
		            "search":"搜索:",
		            "infoFiltered":   "(从  _MAX_ 记录中搜索出结果)",
		            "infoEmpty":      "没有找到匹配的信息",
		         },
		         "ajax": {
		        	 "type": "POST",
		        	 "url": "/userAgent/agentList.do",
 		        	 "dataSrc": function(json) {
		        		 var newJson = json.data
		        		 if (newJson == "未检索到信息") {
		        			 return []
		        		 }
		        		 for (var i = 0; i < newJson.length; i++) {
		         			 var item = newJson[i]
		        			 if (item.state == "1") {
		        				 item.state = "<span class=''>启用</span>"
		        			 } else {
		        				 item.state = "<span class=''>禁用</span>"
		        			 }
		         			 if (item.icode == null) {
		         				 item.icode = "<span class=''>会员</span>"
		         			 } else {
		         				item.icode = "<span class=''>代理</span>" 
		         			 }
		        		 }
		        		 return newJson
		        	 },
		         },
  		         "columns": [
							 {"data": "name"},
		                     {"data": "balance"},
		                     {"data": "nicheng"},
		                     {"data": "icode"},
		                     {"data": "createtime"},
		                     {"data": "lastTime"},
		                     {"data": "lastIp"},
		                     {"data": "state"}
		                 ]
		   		 })
		bindSearchBtnAndResetBtnEvent({
			search: "#button-i-searchAJAXTable",
			reset: "#button-i-resetAJAXTable",
			table: "#table-i-subLevelList",
			params: ["#select-i-accountType", "#input-i-account"],
		})		   		 
		   		 
	</script>
</html>
